﻿using Cxx.Entity;
using Cxx.IDAL;
using Cxx.IOC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cxx.BLL
{
    public class Order
    {
        private static readonly IOrder dal = IocManager.Instance.ResolveIntance<IOrder>();

        public static void Update(OrderInfo info)
        {
            dal.Update(info);
        }

        public static int Insert(OrderInfo info)
        {
            return dal.Insert(info);
        }

        public static OrderInfo Get(int id)
        {
            return dal.Get(id);
        }

        public static List<OrderInfo> GetListForPage(string condition, int pageIndex, int pageSize, out int recordCount)
        {
            return dal.GetListForPage(condition, pageIndex, pageSize, out recordCount);
        }

        public static List<OrderInfo> GetList(string condition)
        {
            return dal.GetList(condition);
        }

        /// <summary>
        /// 计算总额
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public static int CalculateTotal(string condition)
        {
            return dal.CalculateTotal(condition);
        }

        public static bool ExistCustomer(string name)
        {
            return dal.ExistCustomer(name);
        }
    }
}
